#pragma once

#include "LvModel.h"

#include <glm/ext/matrix_transform.hpp> 

#include <memory>

struct TransformComponent
{
	glm::vec3 translation{};
	glm::vec3 scale{ 1.0f, 1.0f, 1.0f };
	glm::vec3 rotation{};

	// Matrix corrsponds to Translate * Ry * Rx * Rz * Scale
	 // Rotations correspond to Tait-bryan angles of Y(1), X(2), Z(3)
	// https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix
	glm::mat4 mat4();
	glm::mat3 normalMatrix();
};


class LvGameObject
{
public:
	using id_t = unsigned int;

	static LvGameObject createGameObject()
	{
		static id_t currentId = 0;
		return LvGameObject(currentId);
	}

	LvGameObject(const LvGameObject&) = delete;
	LvGameObject& operator=(const LvGameObject&) = delete;
	LvGameObject(LvGameObject&&) = default;
	LvGameObject& operator=(LvGameObject&&) = default;
	
	id_t getId()
	{
		return id;
	}

	std::shared_ptr<LvModel> model{};
	glm::vec3 color{1.0f, 1.0f, 1.0f};
	TransformComponent transform{};

private:
	LvGameObject(id_t objId) : id{ objId } {}

	id_t id;

};

